package com.csk.zsk.compents.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.csk.zsk.compents.dao.NoteDao;
import com.csk.zsk.compents.entity.Note;
import com.csk.zsk.compents.service.NoteService;

@Service
@Transactional
public class NoteServiceImpl implements NoteService {

	@Autowired
	private NoteDao noteDao;

	@Override
	public void saveNote(Note note) {
		noteDao.save(note);

	}

	@Override
	public void deleteNote(String id) {
		noteDao.delete(id);

	}

	@Override
	@Transactional(readOnly = true)
	public Note getNoteById(String id) {
		return noteDao.getIdByGetMethod(id);
	}

	@Override
	@Transactional(readOnly = true)
	public List<Note> getNoteByUserId(String userId) {
		return noteDao.findBy("user.id", userId);
	}

}
